<template>
  <div>
    <c-table-box
      ref="cTableBox"
      hide-func
      checkbox
      :no-request="noRequest"
      :other-filters="otherFilters"
      :table-config="tableConfig"
      @selection-change="selectionChange"
    >
      <template #btn>
        <c-permission v-if="type==='all'" code="all">
          <c-button opt-code="add" type="primary" @click="handleApply('1')">新增</c-button>
          <c-button opt-code="export" type="primary" @click="handleExport">导出</c-button>
          <c-button opt-code="reportExport" type="primary" @click="handleReporteExport">待复尺报表</c-button>
          <c-button opt-code="editFile" type="primary" @click="handleEditFile">修改附件</c-button>
        </c-permission>
        <c-permission v-if="type==='submit'" code="submit">
          <c-button opt-code="edit" type="primary" @click="handleApply('2')">编辑</c-button>
          <c-button opt-code="submit" :loading="submitLoading" type="primary" @click="handleSubmit">提交</c-button>
          <c-button opt-code="termination" type="primary" @click="handleTeminal">终止任务</c-button>
          <c-button opt-code="surveyAppDelay" type="primary" @click="handleDelayApply">测绘申请延期</c-button>
          <c-button opt-code="export" type="primary" @click="handleExport">导出</c-button>
        </c-permission>
        <c-permission v-if="type==='arrangeSurvey'" code="arrangeSurvey">
          <c-button opt-code="arrangeSurvey" type="primary" @click="handleMapArrange">安排测绘</c-button>
          <c-button opt-code="arrangeResurvey" type="primary" @click="handleReMapArrange">安排复尺</c-button>
          <c-button opt-code="export" type="primary" @click="handleExport">导出</c-button>
        </c-permission>
        <c-permission v-if="type==='executeSurvey'" code="executeSurvey">
          <c-button opt-code="executeSurvey" type="primary" @click="handleMapExe">执行测绘</c-button>
          <c-button opt-code="delayMeasure" type="primary" @click="handleDelayExemap">延期测量</c-button>
          <c-button opt-code="export" type="primary" @click="handleExport">导出</c-button>
        </c-permission>
        <c-permission v-if="type==='appResurvey'" code="appResurvey">
          <c-button opt-code="resurveyApp" type="primary" @click="handleRemapApply">复尺申请</c-button>
          <c-button opt-code="unresurveyApp" type="primary" @click="handleUnRemap">不复尺申请 </c-button>
          <c-button opt-code="export" type="primary" @click="handleExport">导出</c-button>
        </c-permission>
        <c-permission v-if="type==='resurvey'" code="resurvey">
          <c-button opt-code="executeResurvey" type="primary" @click="handleReMapExe">复尺执行</c-button>
          <c-button opt-code="export" type="primary" @click="handleExport">导出</c-button>
        </c-permission>
        <c-permission v-if="type==='audit'" code="audit">
          <c-button opt-code="surveyAudit" type="primary" @click="handleMapAudit">测绘资料审核</c-button>
          <c-button opt-code="resurveyAudit" type="primary" @click="handleReMapAudit">复尺资料审核</c-button>
        </c-permission>
      </template>

    </c-table-box>
    <export-files v-if="exportVisible" title="导出" :config="exportAllConfig" :visible.sync="exportVisible" @success="handleExportSuccess" />
    <export-files v-if="reporteExportVisible" title="报表导出" :config="reporteExportAllConfig" :visible.sync="reporteExportVisible" @success="handleExportSuccess" />
    <!-- 终止，延期，复尺，不复尺弹窗 -->
    <dlg-form v-if="formVisible" :dlg-type="dlgType" :row-data="activeRowData" :visible.sync="formVisible" @success="refreshTable" />
    <!-- 延期测绘弹窗 -->
    <el-dialog
      ref="refDlg"
      :visible.sync="delayExeVisible"
      :close-on-click-modal="false"
      :close-on-press-escape="false"
      :before-close="closeDialog"
      width="450px"
      @close="closeDialog"
    >
      <!-- 预计测绘时间，延期原因 -->
      <el-form ref="refForm" :rules="delayExeRules" :model="formData" size="mini" label-width="100px">
        <el-row>
          <el-col :span="24">
            <el-form-item label="预计测绘时间:" prop="afterAdjustTime">
              <el-date-picker
                v-model="formData.afterAdjustTime"
                type="date"
                :picker-options="pickerOptions"
                value-format="yyyy-MM-dd 23:59:59"
                placeholder="选择日期"
                clearable
              />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <el-form-item label="延期原因:" prop="exceptionDesc">
              <el-input
                v-model="formData.exceptionDesc"
                maxlength="1000"
                show-word-limit
                :autosize="{ minRows: 4, maxRows: 4}"
                type="textarea"
              />
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button size="mini" @click="closeDialog">取 消</el-button>
        <el-button :loading="saveLoading" size="mini" type="primary" @click="saveDelay">确 定</el-button>
      </span>
    </el-dialog>
    <!-- 附件修改 -->
    <edit-file v-if="showEditFile" :row-data="activeRowData" :visible.sync="showEditFile" @success="refreshTable" />
  </div>
</template>
<script>
import { getExceptionType } from '@/api/common'
import { getDictByPatchType } from '@/api/dataDict'
import { otherFiltersItem } from '@/utils'
import dlgForm from './formDlg.vue'
import { submitBatch, saveException } from '@/api/shopMap'
import { nowTime } from '@/utils/tool.js'
import editFile from './editFile.vue'
export default {
  name: 'List',
  components: { dlgForm, editFile },

  props: {
    type: {
      type: String,
      default: ''
    },
    activeType: {
      type: String,
      default: ''
    },
    noRequest: {
      type: Boolean,
      default: false
    },
    serachFilters: {
      type: Array,
      default: () => []
    }
  },
  data() {
    return {
      pickerOptions: {
        disabledDate(time) {
          var date = new Date()
          var y = date.getFullYear()
          var m = date.getMonth() + 1
          var d = date.getDate()
          var nowTime = new Date(`${y}-${m}-${d} 00:00:00`)
          return time.getTime() < nowTime.getTime()
        }
      },
      saveLoading: false,
      formVisible: false,
      exportVisible: false,
      reporteExportVisible: false,
      showEditFile: false,
      typeFilters: [],
      id: '',
      formData: {
        id: '',
        exceptionHandleId: '',
        exceptionDesc: '',
        afterAdjustTime: '' }, // 延期测绘
      delayLoading: false,
      stopLoading: false,
      doorHeadOptions: [],
      constTypeOptions: [],
      decorationFormOptions: [],
      applyBizTypeOptions: [],
      applySpecialZoneOptions: [],
      // activeDataId: '',
      centerDialogVisible: false,
      loading: false,
      confirmVisible: false,
      showAdd: false,
      delayExeVisible: false, // 显示延期测绘
      delayExeRules: {
        afterAdjustTime: [
          { required: true, message: '请选择预计测绘时间', trigger: 'blur' }
        ],
        exceptionDesc: [
          { required: true, message: '请填写延期原因', trigger: 'blur' }
        ]
      },
      // showInformation: false,
      activeTabIndex: 0,
      activeName: 'all',
      activeRowData: {},
      handlefilters: [],
      // showApply: false,
      showDetail: false,
      decorationRangeOptions: [], // 门店装修范围
      tableSelected: [], // 当前所选中表格行数据
      tableConfig: {
        interfacePath: `${process.env.VUE_APP_BASE_API}/api/v1/shopSurvey/queryByTerm`,
        buttonGroupCode: 'default',
        hideSearchBar: true,
        order: 'desc',
        pageSize: 10,
        sort: 'createTime',
        // 表格字段动态配置
        setting: [

          {
            prop: 'constCode',
            label: '门店建设项目号',
            minWidth: '140',
            className: 'btn-green',
            isButton: true,
            clickFun: this.handleDetail
          },
          {
            prop: 'surveyBatchCode',
            label: '门店测绘批次号',
            minWidth: '140'
          },
          {
            prop: 'state',
            label: '门店测绘进度',
            minWidth: '130',
            propEnum: {
              domainCode: 'marketing',
              appCode: 'slm',
              dictTypeCode: 'SHOP_SURVEY_STATE'
            }
          },
          {
            prop: 'isNeedResurvey',
            label: '是否需要复尺',
            minWidth: '130',
            propEnum: {
              domainCode: 'marketing',
              appCode: 'slm',
              dictTypeCode: 'BOOLEANS'
            }
          },
          {
            prop: 'expectApplySurveyTime',
            label: '预计测绘申请时间',
            minWidth: '150',
            type: 'date'
          },
          {
            prop: 'applyPassTime',
            label: '测绘申请审核通过时间',
            minWidth: '170',
            type: 'date'
          },
          {
            prop: 'isOuttimeUnsurvel',
            label: '测绘申请是否超时',
            minWidth: '140',
            render: function(createElement, rows) {
              if (rows.isOuttimeUnsurvel === 1 || rows.isOuttimeUnsurvel === 0) {
                return (<div>
                  <div class={rows.isOuttimeUnsurvel === 1 ? 'colorSetRed' : ''}>
                    {rows.isOuttimeUnsurvel === 1 ? '是' : '否' }</div>
                </div>
                )
              }
              return ''
            }
          },
          {
            prop: 'officeName',
            label: '办事处',
            minWidth: '110'
          },
          {
            prop: 'clientName',
            label: '客户',
            minWidth: '110'
          },
          {
            prop: 'shopName',
            label: '门店',
            minWidth: '110'
          },
          {
            prop: 'marketType',
            label: '报图类型',
            minWidth: '110',
            propEnum: {
              domainCode: 'marketing',
              appCode: 'slm',
              dictTypeCode: 'MARKET_TYPE'
            }
          },
          {
            prop: 'constType',
            label: '门店建设类型',
            minWidth: '130',
            render: (creat, row) => {
              if (!row.constType || !this.constTypeOptions) {
                return
              }
              let list = []
              if (typeof (row.constType) === 'string') {
                list = row.constType.split(',')
              } else {
                list = row.constType
              }
              const arr = []
              this.constTypeOptions.forEach((item) => {
                const flag = list.some(v => v === item.dictCode)
                if (flag) {
                  arr.push(item.dictName)
                }
              })
              return (<span>{ arr.toString() }</span>)
            }

          },
          {
            prop: 'decorationRange',
            label: '门店建设范围',
            minWidth: '130',
            render: (creat, row) => {
              if (!row.decorationRange) {
                return
              }
              let list = []
              if (typeof (row.decorationRange) === 'string') {
                list = row.decorationRange.split(',')
              } else {
                list = row.decorationRange
              }
              const arr = []
              this.decorationRangeOptions.forEach((item) => {
                const flag = list.some(v => v === item.dictCode)
                if (flag) {
                  arr.push(item.dictName)
                }
              })
              return (<span>{ arr.toString() }</span>)
            }
          },
          {
            prop: 'decorationForm',
            label: '装修形式',
            minWidth: '110',
            render: (creat, row) => {
              if (!row.decorationForm) {
                return
              }
              let list = []
              if (typeof (row.decorationForm) === 'string') {
                list = row.decorationForm.split(',')
              } else {
                list = row.decorationForm
              }
              const arr = []
              this.decorationFormOptions.forEach((item) => {
                const flag = list.some(v => v === item.dictCode)
                if (flag) {
                  arr.push(item.dictName)
                }
              })
              return (<span>{ arr.toString() }</span>)
            }
          },
          {
            prop: 'applyTime',
            label: '测绘申请时间',
            minWidth: '130',
            type: 'date'
          },
          {
            prop: 'applicantName',
            label: '测量申请人',
            minWidth: '110'
          },
          {
            prop: 'expectSurveyTime',
            label: '预计测量时间',
            minWidth: '130',
            type: 'date'
          },
          {
            prop: 'surveyorType',
            label: '测量人类型',
            minWidth: '110',
            propEnum: {
              domainCode: 'marketing',
              appCode: 'slm',
              dictTypeCode: 'SURVEYOR_TYPE'
            }

          },
          {
            prop: 'actualSurveyTime',
            label: '实际测量时间',
            minWidth: '130',
            type: 'date',
            render: function(createElement, rows) {
              if (rows.actualSurveyTime) {
                return (<div>
                  {rows.actualSurveyTime.slice(0, 10)}
                </div>
                )
              }
              return ''
            }
          },
          {
            prop: 'surveyorName',
            label: '测量人',
            minWidth: '120'
          },
          {
            prop: 'resurveyorName',
            label: '复尺人',
            minWidth: '120'
          },
          {
            prop: 'dataSource',
            label: '数据来源',
            minWidth: '110',
            propEnum: {
              domainCode: 'marketing',
              appCode: 'slm',
              dictTypeCode: 'DATA_FROM'
            }
          },
          {
            prop: 'isValid',
            label: '是否有效',
            minWidth: '110',
            propEnum: {
              domainCode: 'marketing',
              appCode: 'slm',
              dictTypeCode: 'BOOLEANS'
            }
          },
          {
            prop: 'isOuttimeMeasure',
            label: '是否测绘超期',
            minWidth: '140',
            render: function(createElement, rows) {
              if (rows.isOuttimeMeasure === 1 || rows.isOuttimeMeasure === 0) {
                return (<div>
                  <div class={rows.isOuttimeMeasure === 1 ? 'colorSetRed' : ''}>
                    {rows.isOuttimeMeasure === 1 ? '是' : '否' }</div>
                </div>
                )
              }
              return ''
            }
          },
          {
            prop: 'unresurveyDesignSetup',
            label: '不复尺设计摆场',
            minWidth: '140',
            propEnum: {
              domainCode: 'marketing',
              appCode: 'slm',
              dictTypeCode: 'UNRESURVEY_STATE'
            }
          },
          {
            prop: 'unresurveyDesignConst',
            label: '不复尺设计施工',
            minWidth: '140',
            propEnum: {
              domainCode: 'marketing',
              appCode: 'slm',
              dictTypeCode: 'UNRESURVEY_STATE'
            }
          },
          {
            prop: 'createTime',
            label: '创建时间',
            minWidth: '140'
          }

        ]
      },
      showApply: false,
      submitLoading: false,
      showMapArrange: false,
      showMapExe: false,
      showReMapArrange: false,
      showReMapExe: false,
      showMapAudit: false,
      showReMapAudit: false,
      activeDataId: '',
      dlgType: ''
    }
  },
  computed: {
    otherFilters() {
      return [...this.serachFilters, ...this.typeFilters]
    },
    selectedIds() {
      return this.tableSelected.map(row => {
        return row.id
      })
    },
    exportAllConfig() {
      return [{
        code: 'export',
        name: '门店测绘管理',
        dataApi: '/slm-admin/api/v1/shopSurvey/export?type=0',
        selectedRows: this.tableSelected,
        paramsRaw: {},
        headers: { 'Permission-perCode': 'storemapping' },
        filtersRaw: this.otherFilters,
        queryField: 'id'
      }]
    },
    reporteExportAllConfig() {
      return [{
        code: 'reportExport',
        name: '待复尺报表导出',
        dataApi: '/slm-admin/api/v1/waitResurveyReport/export',
        selectedRows: this.tableSelected,
        paramsRaw: { },
        // paramsRaw: { state: 'H', isValid: '1', isEnd: '0' },
        headers: { 'Permission-perCode': 'storemapping' },
        filtersRaw: this.otherFilters,
        queryField: 'id'
      }]
    }
  },
  watch: {
    type: {
      handler(v) {
        this.setOtherFilters(v)
      },
      immediate: true
    },
    serachFilters: {
      handler(v) {
        if (this.activeType !== this.type) return
        this.refreshTable('')
      }
    }
  },
  activated() {
    if (this.ready && this.refreshTable) {
      this.refreshTable()
    }
  },
  deactivated() {
    this.ready = true
  },
  created() {
    this.getDictByPatchTypeAll()
  },
  methods: {
    // 附件修改，2022/5/5新增功能
    handleEditFile() {
      if (!this.singleJudge(this.tableSelected, '修改', true)) {
        return
      }
      const list = ['E', 'F', 'G', 'H', 'I', 'J']
      const index = list.findIndex(v => v === this.tableSelected[0].state)
      if (index === -1) {
        this.$message.warning('当前进度不允许编辑')
        return
      }
      this.activeRowData = this.tableSelected[0]
      this.showEditFile = true
    },
    // 延期测绘，2022/1/18新增
    handleDelayExemap() {
      if (!this.singleJudge(this.tableSelected, '延期测量', true)) {
        return
      }
      this.activeRowData = this.tableSelected[0]
      this.delayExeVisible = true
    },
    closeDialog() {
      this.delayExeVisible = false
      this.clearForm()
    },
    clearForm() {
      this.formData = {
        id: '',
        exceptionHandleId: '',
        exceptionDesc: '',
        afterAdjustTime: ''
      }
    },
    // 提交延期测绘
    async   saveDelay() {
      const pass = await this.$refs['refForm'].validate()
      if (!pass) return
      await getExceptionType('延期测量').then(res => {
        if (res.success === 1 && res.data.records.length > 0) {
          this.$set(this.formData, 'exceptionHandleId', res.data.records[0].id)
        }
      })
      const submitForm = {
        modelId: this.activeRowData.id,
        exceptionHandleId: this.formData.exceptionHandleId || '',
        constCode: this.activeRowData.constCode || '',
        bizCode: this.activeRowData.surveyBatchCode || '',
        bizName: '延期测量',
        exceptionDesc: this.formData.exceptionDesc,
        belongModel: 'SHOP_SURVEY',
        state: 'A',
        shopExceptionDetailDTOS: [
          {
            afterAdjustTime: this.formData.afterAdjustTime || '',
            beforeAdjustTime: this.activeRowData.expectSurveyTime || '',
            exceptionDesc: this.formData.exceptionDesc,
            applicantCode: this.$store.getters.user.data.account || '',
            applyTime: nowTime()
          }
        ]
      }
      if (!submitForm.exceptionHandleId) {
        this.$message.warning('未获取到异常配置id')
        return
      }
      this.saveLoading = true
      saveException(submitForm).then(res => {
        if (res.success === 1) {
          this.$message.success('延期申请提交成功')
          this.closeDialog()
          this.refreshTable()
          this.saveLoading = false
        }
      }).catch(() => {
        this.saveLoading = false
      })
    },
    // 提交
    handleSubmit() {
      if (!this.singleJudge(this.tableSelected, '提交', false)) {
        return
      }
      this.$confirm(`是否确认将勾选的【${this.tableSelected.length}条】数据提交?`, '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        // 调用接口执行提交
        submitBatch(this.selectedIds).then(res => {
          if (res.success === 1) {
            this.$message({
              message: res.msg || '提交成功',
              type: 'success'
            })
            this.refreshTable()
          }
        })
      }).catch(() => {
      })
    },
    async getDictByPatchTypeAll() {
      const { CONST_TYPE, DECORATION_RANGE, DECORATION_FORM } =
       await getDictByPatchType(['CONST_TYPE', 'DECORATION_RANGE', 'DECORATION_FORM'])
      this.constTypeOptions = CONST_TYPE // 门店建设
      this.decorationRangeOptions = DECORATION_RANGE// 门店装修范围
      this.decorationFormOptions = DECORATION_FORM// 装修形式
    },
    // 安排测绘
    handleMapArrange() {
      if (!this.singleJudge(this.tableSelected, '安排测绘', true)) {
        return
      }
      if (this.tableSelected[0].state !== 'C') {
        this.$message.warning('【已审核】数据才能安排测绘')
        return
      }
      this.$router.push({ name: 'MapArrange', query: { id: this.tableSelected[0].id }})
    },
    // 复尺安排
    handleReMapArrange() {
      if (!this.singleJudge(this.tableSelected, '安排复尺', true)) {
        return
      }
      if (this.tableSelected[0].state !== 'G') {
        this.$message.warning('【复尺申请待审核】数据才能安排复尺')
        return
      }
      this.$router.push({ name: 'ReMapArrange', query: { id: this.tableSelected[0].id }})
    },
    // 测绘执行
    handleMapExe() {
      if (!this.singleJudge(this.tableSelected, '执行测绘', true)) {
        return
      }
      this.$router.push({ name: 'MapExe', query: { id: (this.tableSelected.length > 0 && this.tableSelected[0].id) || '' }})
    },
    // 复尺执行
    handleReMapExe() {
      if (!this.singleJudge(this.tableSelected, '执行复尺', true)) {
        return
      }
      this.$router.push({ name: 'ReMapExe', query: { id: (this.tableSelected.length > 0 && this.tableSelected[0].id) || '' }})
    },
    // 测绘审核
    handleMapAudit() {
      if (!this.singleJudge(this.tableSelected, '审核', true)) {
        return
      }
      if (this.tableSelected[0].state !== 'E') {
        this.$message.warning('【测绘结果待审核】数据才能审核测绘')
        return
      }
      this.$router.push({ name: 'MapAudit', query: { id: this.tableSelected[0].id }})
    },
    // 复尺审核
    handleReMapAudit() {
      if (!this.singleJudge(this.tableSelected, '审核', true)) {
        return
      }
      if (this.tableSelected[0].state !== 'I') {
        this.$message.warning('【复尺结果待审核】数据才能审核复尺')
        return
      }
      this.$router.push({ name: 'ReMapAudit', query: { id: this.tableSelected[0].id }})
    },
    // 测绘申请
    handleApply(data) {
      if (data === '1') {
        this.$router.push({ name: 'MapApply' })
      } else {
        if (!this.singleJudge(this.tableSelected, '编辑', true)) {
          return
        }
        this.$router.push({ name: 'MapApply', query: { id: this.tableSelected[0].id }})
      }
    },
    selectionChange(v) {
      this.tableSelected = v
    },
    // 终止任务
    handleTeminal() {
      if (!this.singleJudge(this.tableSelected, '终止任务', true)) {
        return
      }
      if (this.tableSelected[0].dataSource === 'ARTIFICIAL' && this.tableSelected[0].state === 'A') {
        this.activeRowData = this.tableSelected[0]
        this.dlgType = 'terminal'
        this.formVisible = true
      } else {
        this.$message.warning('该条数据不能终止!')
      }
    },
    // 复尺申请
    handleRemapApply() {
      if (!this.singleJudge(this.tableSelected, '复尺', true)) {
        return
      }
      if (this.tableSelected[0].unresurveyDesignSetup === 'B' || this.tableSelected[0].unresurveyDesignConst === 'B') {
        this.$message.warning('复尺申请已提报')
        return
      }
      this.activeRowData = this.tableSelected[0]
      this.dlgType = 'remap'
      this.formVisible = true
    },
    // 不复尺申请
    handleUnRemap() {
      if (!this.singleJudge(this.tableSelected, '不复尺', true)) {
        return
      }
      if (this.tableSelected[0].unresurveyDesignSetup === 'B' || this.tableSelected[0].unresurveyDesignConst === 'B') {
        this.$message.warning('不复尺申请已提报')
        return
      }
      this.activeRowData = this.tableSelected[0]
      this.dlgType = 'unRemap'
      this.formVisible = true
    },
    //  申请延期
    handleDelayApply() {
      if (!this.singleJudge(this.tableSelected, '申请延期', true)) {
        return
      }
      this.activeRowData = this.tableSelected[0]
      this.dlgType = 'delay'
      this.formVisible = true
    },
    // 导出
    handleExport() {
      this.exportVisible = true
    },
    // 报表导出
    handleReporteExport() {
      this.reporteExportVisible = true
    },
    handleDetail(val) {
      this.$router.push({ name: 'MapDetail', query: { id: val.id }})
    },

    // 设置过滤条件
    setOtherFilters(v) {
      switch (v) {
        case 'all':
          this.typeFilters = []
          break
        case 'submit':// 待提交
          this.typeFilters = [
            otherFiltersItem('state', 'A', '='), // 显示“已保存”数据
            otherFiltersItem('isEnd', '0', '=')
          ]// 是否完结为否的数据
          break
        case 'arrangeSurvey':// 待安排测绘
          this.typeFilters = [
            otherFiltersItem('state', '[G,C]', 'in'), // “已审核C”和“待安排复尺G”
            otherFiltersItem('isValid', '1', '='), // 是否有效
            otherFiltersItem('isEnd', '0', '=')
          ]// 是否完结为否的数据
          break
        case 'executeSurvey':// 待执行测绘
          this.typeFilters = [
            otherFiltersItem('state', 'D', '='), // "已安排测绘"
            otherFiltersItem('isValid', '1', '='), // 是否有效
            otherFiltersItem('isEnd', '0', '=')
          ]// 是否完结为否的数据
          break
        case 'appResurvey':// 待复尺申请
          this.typeFilters = [
            otherFiltersItem('state', 'F', '='), // "待复尺申请"
            otherFiltersItem('isValid', '1', '='), // 是否有效
            otherFiltersItem('isEnd', '0', '=')
          ]// 是否完结为否的数据
          break
        case 'resurvey':// 待复尺
          this.typeFilters = [
            otherFiltersItem('state', 'H', '='), // "待复尺"
            otherFiltersItem('isValid', '1', '='), // 是否有效
            otherFiltersItem('isEnd', '0', '=')
          ]// 是否完结为否的数据
          break
        case 'audit':// 测绘资料审核
          this.typeFilters = this.typeFilters = [
            otherFiltersItem('state', '[I,E]', 'in'), // 复尺结果待审核I，测绘结果待审核E
            otherFiltersItem('isValid', '1', '='), // 是否有效
            otherFiltersItem('isEnd', '0', '=')
          ]// 是否完结为否的数据
          break
      }
    },
    // 刷新表格
    refreshTable(v = 'onPage') {
      this.$nextTick(() => {
        this.$refs.cTableBox.initTableData(v)
      })
    },

    // 导出成功
    handleExportSuccess() {
      this.$message.success('导出成功！')
    },
    // 导入成功
    handleImportSuccess() {
      this.$message.success('导入成功！')
    }
  }
}
</script>
